package cn.clq.ymcc.feign;

import cn.clq.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author clqlongbao
 * @version 1.0
 * @description: TODO
 * @date 2022/7/28 14:51
 */
@Component
public class CoursePermissionFeignClientFallBackFactory implements FallbackFactory<CoursePermissionFeignClient> {
    @Override
    public CoursePermissionFeignClient create(Throwable throwable) {
        return new CoursePermissionFeignClient() {
            @Override
            public JSONResult checkMediaPermission(Long loginId, Long courseId) {
                throwable.printStackTrace();
                return JSONResult.error("课程服务不可达-校验权限");
            }

            @Override
            public JSONResult searchCourseOrderInfo(String courseIds) {
                throwable.printStackTrace();
                return JSONResult.error("课程服务不可达-查询订单页详细信息");
            }
        };
    }
}
